package cn.yunyichina.provider.pay.kafka;

import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.GenericMessage;

/**
 * Created by Lullaby on 2016/10/24.
 */
public class AppTestProducer {

    @Test
    public void test() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        context.start();
        try {
            MessageChannel channel = (MessageChannel) context.getBean("inputToKafka");
            Message<String> message = new GenericMessage("spring kafka test");
            boolean flag = channel.send(message);
            System.out.println(flag);
        } finally {
            context.stop();
            context.close();
        }
    }

}
